home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / SCSL / ccfft3d.z / ccfft3d
Encoding:
Text File  |  2002-10-03  |  33.5 KB  |  727 lines

  1.  
  2.  
  3.  
  4. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      CCCCCCCCFFFFFFFFTTTT3333DDDD, ZZZZZZZZFFFFFFFFTTTT3333DDDD - Applies a three-dimensional complex-to-complex Fast
  10.      Fourier Transform (FFT)
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      Single precision complex -> Single precision complex
  14.  
  15.           Fortran:
  16.                CCCCAAAALLLLLLLL CCCCCCCCFFFFFFFFTTTT3333DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _n_3,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _l_d_x_2,,,, _y,,,, _l_d_y,,,,
  17.                _l_d_y_2,,,, _t_a_b_l_e,,,, _w_o_r_k,,,, _i_s_y_s))))
  18.  
  19.           C/C++:
  20.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  21.                iiiinnnntttt ccccccccfffffffftttt3333dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, iiiinnnntttt _n_3,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,,
  22.                ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _l_d_x,,,, iiiinnnntttt _l_d_x_2,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _l_d_y,,,,
  23.                iiiinnnntttt _l_d_y_2,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,, ffffllllooooaaaatttt *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  24.  
  25.           C++ STL:
  26.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  27.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  28.                iiiinnnntttt ccccccccfffffffftttt3333dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, iiiinnnntttt _n_3,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,,
  29.                ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_x,,,, iiiinnnntttt _l_d_x,,,, iiiinnnntttt _l_d_x_2,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_y,,,, iiiinnnntttt
  30.                _l_d_y,,,, iiiinnnntttt _l_d_y_2,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,, ffffllllooooaaaatttt *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  31.  
  32.      Double precision complex -> Double precision complex
  33.  
  34.           Fortran:
  35.                CCCCAAAALLLLLLLL ZZZZZZZZFFFFFFFFTTTT3333DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _n_3,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _l_d_x_2,,,, _y,,,, _l_d_y,,,,
  36.                _l_d_y_2,,,, _t_a_b_l_e,,,, _w_o_r_k,,,, _i_s_y_s))))
  37.  
  38.           C/C++:
  39.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  40.                iiiinnnntttt zzzzzzzzfffffffftttt3333dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, iiiinnnntttt _n_3,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,,
  41.                ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _l_d_x,,,, iiiinnnntttt _l_d_x_2,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _l_d_y,,,,
  42.                iiiinnnntttt _l_d_y_2,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,, ddddoooouuuubbbblllleeee *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  43.  
  44.           C++ STL:
  45.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  46.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  47.                iiiinnnntttt zzzzzzzzfffffffftttt3333dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, iiiinnnntttt _n_3,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,,
  48.                ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_x,,,, iiiinnnntttt _l_d_x,,,, iiiinnnntttt _l_d_x_2,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_y,,,, iiiinnnntttt
  49.                _l_d_y,,,, iiiinnnntttt _l_d_y_2,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,, ddddoooouuuubbbblllleeee *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  50.  
  51. IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTAAAATTTTIIIIOOOONNNN
  52.      These routines are part of the SCSL Scientific Library and can be loaded
  53.      using either the ----llllssssccccssss or the ----llllssssccccssss____mmmmpppp option.  The ----llllssssccccssss____mmmmpppp option
  54.      directs the linker to use the multi-processor version of the library.
  55.  
  56.      When linking to SCSL with ----llllssssccccssss or ----llllssssccccssss____mmmmpppp, the default integer size is
  57.      4 bytes (32 bits). Another version of SCSL is available in which integers
  58.      are 8 bytes (64 bits).  This version allows the user access to larger
  59.      memory sizes and helps when porting legacy Cray codes.  It can be loaded
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  71.  
  72.  
  73.  
  74.      by using the ----llllssssccccssss____iiii8888 option or the ----llllssssccccssss____iiii8888____mmmmpppp option. A program may use
  75.      only one of the two versions; 4-byte integer and 8-byte integer library
  76.      calls cannot be mixed.
  77.  
  78.      The C and C++ prototypes shown above are appropriate for the 4-byte
  79.      integer version of SCSL. When using the 8-byte integer version, the
  80.      variables of type iiiinnnntttt become lllloooonnnngggg lllloooonnnngggg and the <<<<ssssccccssssllll____fffffffftttt____iiii8888....hhhh>>>> header
  81.      file should be included.
  82.  
  83. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  84.      These routines compute the three-dimensional complex FFT of the complex
  85.      matrix _X, and store the results in the complex matrix _Y.
  86.  
  87.      In FFT applications, it is customary to use zero-based subscripts; the
  88.      formulas are simpler that way.  So suppose the arrays are declared as
  89.      follows:
  90.  
  91.           Fortran:
  92.  
  93.                COMPLEX X(0:ldx-1, 0:ldx2-1, 0:n3-1)
  94.                COMPLEX Y(0:ldy-1, 0:ldy2-1, 0:n3-1)
  95.  
  96.  
  97.           C/C++:
  98.  
  99.                scsl_complex x[n3][ldx2][ldx], y[n3][ldy2][ldy];
  100.  
  101.  
  102.           C++ STL:
  103.  
  104.                complex<float> x[n3][ldx2][ldx], y[n3][ldy2][ldy];
  105.  
  106.  
  107.      These routines compute the formula:
  108.  
  109.      Y(k1,k2,k3) =
  110.  
  111.            n1-1 n2-1 n3-1
  112.      scale*Sum  Sum  Sum  [X(j1,j2,j3)*w1**(j1*k1)*w2**(j2*k2)*w3**(j3*k3)]
  113.            j1=0 j2=0 j3=0
  114.  
  115.      for _k_1 = 0, ..., _n_1 - 1,
  116.          _k_2 = 0, ..., _n_2 - 1,
  117.          _k_3 = 0, ..., _n_3 - 1,
  118.  
  119.  
  120.      where:
  121.  
  122.      _w_1        = exp(_i_s_i_g_n*2*_p_i*_i/_n_1),
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  137.  
  138.  
  139.  
  140.      _w_2        = exp(_i_s_i_g_n*2*_p_i*_i/_n_2),
  141.  
  142.      _w_3        = exp(_i_s_i_g_n*2*_p_i*_i/_n_3),
  143.  
  144.      _i         = + sqrt(-1)
  145.  
  146.      _p_i        = 3.14159...
  147.  
  148.      _i_s_i_g_n     = +1 or -1
  149.  
  150.      Different authors use different conventions for which of the transforms,
  151.      _i_s_i_g_n = +1 or _i_s_i_g_n = -1, is the forward or inverse transform, and what
  152.      the _s_c_a_l_e factor should be in either case.  You can make this routine
  153.      compute any of the various possible definitions, however, by choosing the
  154.      appropriate values for _i_s_i_g_n and _s_c_a_l_e.
  155.  
  156.      The relevant fact from FFT theory is this:  If you take the FFT with any
  157.      particular values of _i_s_i_g_n and _s_c_a_l_e, the mathematical inverse function
  158.      is computed by taking the FFT with -_i_s_i_g_n and 1/(_n_1 * _n_2 * _n_3 * _s_c_a_l_e).
  159.      In particular, if you use _i_s_i_g_n = +1 and _s_c_a_l_e = 1.0 for the forward FFT,
  160.      you can compute the inverse FFT by using _i_s_i_g_n = -1 and _s_c_a_l_e = 1/(_n_1 *
  161.      _n_2 * _n_3).
  162.  
  163.      See the NOTES section of this man page for information about the
  164.      interpretation of the data types described in the following arguments.
  165.  
  166.      This routine has the following arguments:
  167.  
  168.      _i_s_i_g_n     Integer.  (input)
  169.                Specifies whether to initialize the _t_a_b_l_e array or to do the
  170.                forward or inverse Fourier transform, as follows:
  171.  
  172.                If _i_s_i_g_n = 0, the routine initializes the _t_a_b_l_e array and
  173.                returns.  In this case, the only arguments used or checked are
  174.                _i_s_i_g_n, _n_1, _n_2, _n_3, and _t_a_b_l_e.
  175.  
  176.                If _i_s_i_g_n = +1 or -1, the value of _i_s_i_g_n is the sign of the
  177.                exponent used in the FFT formula.
  178.  
  179.      _n_1        Integer.  (input)
  180.                Transform size in the first dimension.  If _n_1 is not positive,
  181.                the routine returns without computing a transform.
  182.  
  183.      _n_2        Integer.  (input)
  184.                Transform size in the second dimension.  If _n_2 is not positive,
  185.                the routine returns without computing a transform.
  186.  
  187.      _n_3        Integer.  (input)
  188.                Transform size in the third dimension.  If _n_3 is not positive,
  189.                the routine returns without computing a transform.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  203.  
  204.  
  205.  
  206.      _s_c_a_l_e     Scale factor. (input)
  207.                CCCCCCCCFFFFFFFFTTTT3333DDDD: Single precision.
  208.                ZZZZZZZZFFFFFFFFTTTT3333DDDD: Double precision.
  209.                Each element of the output array is multiplied by _s_c_a_l_e after
  210.                taking the Fourier transform, as defined previously.
  211.  
  212.      _x         Array of dimensions (_l_d_x, _l_d_x_2, _n_3).  (input)
  213.                CCCCCCCCFFFFFFFFTTTT3333DDDD: Single precision complex array.
  214.                ZZZZZZZZFFFFFFFFTTTT3333DDDD: Double complex array.
  215.                Input array of values to be transformed.
  216.  
  217.      _l_d_x       Integer.  (input)
  218.                The first dimension of _x, as it was declared in the calling
  219.                program (the leading dimension of _x).  _l_d_x >= MMMMAAAAXXXX(_n_1, 1).
  220.  
  221.      _l_d_x_2      Integer.  (input)
  222.                The second dimension of _x, as it was declared in the calling
  223.                program.  _l_d_x_2 >= MMMMAAAAXXXX(_n_2, 1).
  224.  
  225.      _y         Array of dimensions (_l_d_y, _l_d_y_2, _n_3).  (output)
  226.                CCCCCCCCFFFFFFFFTTTT3333DDDD: Single precision complex array.
  227.                ZZZZZZZZFFFFFFFFTTTT3333DDDD: Double complex array.
  228.                Output array of transformed values.  The output array may be
  229.                the same as the input array, in which case, the transform is
  230.                done in place; that is, the input array is overwritten with the
  231.                transformed values.  In this case, it is necessary that
  232.                _l_d_x = _l_d_y, and _l_d_x_2 = _l_d_y_2.
  233.  
  234.      _l_d_y       Integer.  (input)
  235.                The first dimension of _y, as it was declared in the calling
  236.                program (the leading dimension of _y).  _l_d_y >= MMMMAAAAXXXX(_n_1, 1).
  237.  
  238.      _l_d_y_2      Integer.  (input)
  239.                The second dimension of _y, as it was declared in the calling
  240.                program.  _l_d_y_2 >= MMMMAAAAXXXX(_n_2, 1).
  241.  
  242.      _t_a_b_l_e     Array of dimension (2* _n_1 + _N_F) + (2 * _n_2 + _N_F) + (2 * _n_3 + _N_F)
  243.                (input or output)
  244.                CCCCCCCCFFFFFFFFTTTT3333DDDD: Single precision array.
  245.                ZZZZZZZZFFFFFFFFTTTT3333DDDD: Double precision array.
  246.  
  247.                Table of factors and root of unity.  See the description of the
  248.                _i_s_y_s argument for the value of _N_F.
  249.  
  250.                If _i_s_i_g_n = 0, the routine initializes _t_a_b_l_e (_t_a_b_l_e is output
  251.                only).
  252.  
  253.                If _i_s_i_g_n = +1 or -1, the values in _t_a_b_l_e are assumed to be
  254.                initialized already by a prior call with _i_s_i_g_n = 0 (_t_a_b_l_e is
  255.                input only).
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  269.  
  270.  
  271.  
  272.      _w_o_r_k      Array of dimension 2 * MMMMAAAAXXXX((((_n_1,,,, _n_2,,,, _n_3))))
  273.                CCCCCCCCFFFFFFFFTTTT3333DDDD: Single precision array.
  274.                ZZZZZZZZFFFFFFFFTTTT3333DDDD: Double precision array.
  275.  
  276.                Work array.  This is a scratch array used for intermediate
  277.                calculations.  Its address space must be different from that of
  278.                the input and output arrays.
  279.  
  280.      _i_s_y_s      Integer array dimensioned 0000........_i_s_y_s((((0000)))).
  281.                An array that gives implementation-specific information.  All
  282.                features and functions of the FFT routines specific to any
  283.                particular implementation are confined to this _i_s_y_s array.
  284.  
  285.                In the Origin series implementation, _i_s_y_s((((0000))))====0000 and _i_s_y_s((((0000))))====1111
  286.                are supported.  In SCSL versions prior to 1.3, only _i_s_y_s((((0000))))====0000
  287.                was allowed. For _i_s_y_s((((0000))))====0000, _N_F====33330000, and for _i_s_y_s((((0000))))====1111, _N_F====222255556666.
  288.                The _N_F words of storage in the _t_a_b_l_e array contain a
  289.                factorization of the length of the transform.
  290.  
  291.                The smaller value of _N_F for _i_s_y_s((((0000))))====0000 is historical. It is too
  292.                small to store all the required factors for the highest
  293.                performing FFT, so when _i_s_y_s((((0000))))====0000, extra space is allocated
  294.                when the _t_a_b_l_e array is initialized. To avoid memory leaks,
  295.                this extra space must be deallocated when the _t_a_b_l_e array is no
  296.                longer needed. The CCCCCCCCFFFFFFFFTTTT3333DDDDFFFF routine is used to release this
  297.                memory. Due to the potential for memory leaks, the use of
  298.                _i_s_y_s((((0000))))====0000 should be avoided.
  299.  
  300.                For _i_s_y_s((((0000))))====1111, the value of _N_F is large enough so that no extra
  301.                memory needs to be allocated, and there is no need to call
  302.                CCCCCCCCFFFFFFFFTTTT3333DDDDFFFF to release memory. If called, it does nothing.
  303.  
  304.                NOTE: _i_s_y_s((((0000))))====1111 means that _i_s_y_s is an integer array with two
  305.                elements. The second element, _i_s_y_s((((1111)))), will not be accessed.
  306.  
  307. NNNNOOOOTTTTEEEESSSS
  308.      The following data types are described in this documentation:
  309.  
  310.           TTTTeeeerrrrmmmm UUUUsssseeeedddd                     DDDDaaaattttaaaa ttttyyyyppppeeee
  311.  
  312.      Fortran:
  313.  
  314.           Array dimensioned 0000........_n----1111      xxxx((((0000::::nnnn----1111))))
  315.  
  316.           Array of dimensions (_m,_n)     xxxx((((mmmm,,,,nnnn))))
  317.  
  318.           Array of dimensions (_m,_n,_p)   xxxx((((mmmm,,,,nnnn,,,,pppp))))
  319.  
  320.           Integer                       IIIINNNNTTTTEEEEGGGGEEEERRRR (IIIINNNNTTTTEEEEGGGGEEEERRRR****8888 for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  335.  
  336.  
  337.  
  338.           Single precision              RRRREEEEAAAALLLL
  339.  
  340.           Double precision              DDDDOOOOUUUUBBBBLLLLEEEE PPPPRRRREEEECCCCIIIISSSSIIIIOOOONNNN
  341.  
  342.           Single precision complex      CCCCOOOOMMMMPPPPLLLLEEEEXXXX
  343.  
  344.           Double precision complex      DDDDOOOOUUUUBBBBLLLLEEEE CCCCOOOOMMMMPPPPLLLLEEEEXXXX
  345.  
  346.      C/C++:
  347.  
  348.           Array dimensioned 0000........_n----1111      xxxx[[[[_n]]]]
  349.  
  350.           Array of dimensions (_m,_n)     xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]]
  351.  
  352.           Array of dimensions (_m,_n,_p)   xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]]
  353.  
  354.           Integer                       iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  355.  
  356.           Single precision              ffffllllooooaaaatttt
  357.  
  358.           Double precision              ddddoooouuuubbbblllleeee
  359.  
  360.           Single precision complex      ssssccccssssllll____ccccoooommmmpppplllleeeexxxx
  361.  
  362.           Double precision complex      ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx
  363.  
  364.      C++ STL:
  365.  
  366.           Array dimensioned 0000........_n----1111      xxxx[[[[_n]]]]
  367.  
  368.           Array of dimensions (_m,_n)     xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]]
  369.  
  370.           Array of dimensions (_m,_n,_p)   xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]]
  371.  
  372.           Integer                       iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  373.  
  374.           Single precision              ffffllllooooaaaatttt
  375.  
  376.           Double precision              ddddoooouuuubbbblllleeee
  377.  
  378.           Single precision complex      ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>>
  379.  
  380.           Double precision complex      ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>>
  381.  
  382. CCCCAAAAUUUUTTTTIIIIOOOONNNNSSSS
  383.      Transform sizes with a prime factor exceeding 22223332222----1111 are not supported for
  384.      the 8-byte integer version of the library.
  385.  
  386.      In addition to the _w_o_r_k array, the FFT routines also dynamically allocate
  387.      scratch space from the stack. The amount of space allocated can be
  388.      slightly bigger than the size of the largest processor cache. For single
  389.      processor runs, the default stack size is large enough that these
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  401.  
  402.  
  403.  
  404.      allocations generally cause no problems. But for parallel runs, you need
  405.      to ensure that the stack size of slave threads is big enough to hold this
  406.      scratch space. Failure to reserve sufficient stack space will cause
  407.      programs to dump core due to stack overflows.  The stack size of MP
  408.      library slave threads is controlled via the MMMMPPPP____SSSSLLLLAAAAVVVVEEEE____SSSSTTTTAAAACCCCKKKKSSSSIIIIZZZZEEEE
  409.      environment variable or the mmmmpppp____sssseeeetttt____ssssllllaaaavvvveeee____ssssttttaaaacccckkkkssssiiiizzzzeeee(((()))) library routine. See
  410.      the mmmmpppp(3C), mmmmpppp(3F) and ppppeeee____eeeennnnvvvviiiirrrroooonnnn(5) reference pages for more information
  411.      on controlling the slave stack size. For pthreads applications, the
  412.      thread's stack size is specified as one of many creation attributes
  413.      provided in the pthread_attr_t argument to pppptttthhhhrrrreeeeaaaadddd____ccccrrrreeeeaaaatttteeee(3P).  The
  414.      stacksize attribute should be set explicitly to a non-default value using
  415.      the pppptttthhhhrrrreeeeaaaadddd____aaaattttttttrrrr____sssseeeettttssssttttaaaacccckkkkssssiiiizzzzeeee(3P) call, described in the
  416.      pppptttthhhhrrrreeeeaaaadddd____aaaattttttttrrrr____iiiinnnniiiitttt(3P) man page.
  417.  
  418.      Care must be exercised if copies of the _t_a_b_l_e array are used: even though
  419.      a copy exists, the original must persist. As an example, the following
  420.      code will nnnnooootttt work:
  421.  
  422.      #include <scsl_fft.h>
  423.      scsl_complex x[129][129][129], y[129][129][129];
  424.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  425.      float work[2*128];
  426.      int isys[2];
  427.      isys[0] = 1;
  428.      {
  429.        float table_orig[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  430.  
  431.        ccfft3d(0, 128, 128, 128, 1.0f, (scsl_complex *) x, 129,
  432.               129, (scsl_complex *) y, 129, 129, table_orig,
  433.               work, isys);
  434.        bcopy(table_orig, table,
  435.              ((2*128+256)+(2*256+256)+(2*256+256))*sizeof(float));
  436.      }
  437.      ccfft3d(1, 128, 128, 128, 1.0f, (scsl_complex *) x, 129,
  438.             129, (scsl_complex *) y, 129, 129, table, work, isys);
  439.  
  440.  
  441.      In this example, because _t_a_b_l_e__o_r_i_g is a stack variable that does not
  442.      persist outside of the code block delimited by the braces, the data in
  443.      the copy, _t_a_b_l_e, are not guaranteed to be valid. However, the following
  444.      code will work because _t_a_b_l_e__o_r_i_g is persistent:
  445.  
  446.      #include <scsl_fft.h>
  447.      scsl_complex x[129][129][129], y[129][129][129];
  448.      float table_orig[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  449.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  450.      float work[2*128];
  451.      int isys[2];
  452.      isys[0] = 1;
  453.      ccfft3d(0, 128, 128, 128, 1.0f, (scsl_complex *) x, 129,
  454.              129, (scsl_complex *) y, 129, 129, table_orig,
  455.              work, isys);
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  467.  
  468.  
  469.  
  470.      bcopy(table_orig, table,
  471.              ((2*128+256)+(2*256+256)+(2*256+256))*sizeof(float));
  472.      ccfft3d(1, 128, 128, 128, 1.0f, (scsl_complex *) x, 129,
  473.              129, (scsl_complex *) y, 129, 129, table,
  474.              work, isys);
  475.  
  476.  
  477. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  478.      The following examples are for Origin series only.
  479.  
  480.      Example 1:  Initialize the TTTTAAAABBBBLLLLEEEE array in preparation for doing a three-
  481.      dimensional FFT of size 128 by 128 by 128.  In this case, only the _i_s_i_g_n,
  482.      _n_1, _n_2, _n_3, and _t_a_b_l_e arguments are used; you can use dummy arguments or
  483.      zeros for other arguments.
  484.  
  485.      Fortran:
  486.  
  487.       REAL TABLE ((2*128 + 256) + (2*128 + 256) + (2*128 + 256))
  488.       INTEGER ISYS(0:1)
  489.       ISYS(0) = 1
  490.       CALL CCFFT3D (0, 128, 128, 128, 0.0, DUMMY, 1, 1, DUMMY, 1, 1,
  491.      &              TABLE, DUMMY, ISYS)
  492.  
  493.  
  494.      C/C++:
  495.  
  496.           #include <scsl_fft.h>
  497.           float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  498.           int isys[2];
  499.           isys[0] = 1;
  500.           ccfft3d(0, 128, 128, 128, 0.0f, NULL, 1, 1, NULL, 1, 1,
  501.                   table, NULL, isys);
  502.  
  503.  
  504.      C++ STL:
  505.  
  506.           #include <complex.h>
  507.           #include <scsl_fft.h>
  508.           float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  509.           int isys[2];
  510.           isys[0] = 1;
  511.           ccfft3d(0, 128, 128, 128, 0.0f, NULL, 1, 1, NULL, 1, 1,
  512.                   table, NULL, isys);
  513.  
  514.  
  515.      Example 2:  XXXX and YYYY are complex arrays of dimension (0:128, 0:128,
  516.      0:128).  The first 128 elements of each dimension contain data; for
  517.      performance reasons, the extra element forces the leading dimensions to
  518.      be odd numbers.  Take the three-dimensional FFT of XXXX and store it in YYYY.
  519.      Initialize the TTTTAAAABBBBLLLLEEEE array, as in example 1.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                                                         PPPPaaaaggggeeee 8888
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  533.  
  534.  
  535.  
  536.      Fortran:
  537.  
  538.       COMPLEX X(0:128, 0:128, 0:128)
  539.       COMPLEX Y(0:128, 0:128, 0:128)
  540.       REAL TABLE((2*128 + 256) + (2*128 + 256) + (2*128 + 256))
  541.       REAL WORK (2*128)
  542.       INTEGER ISYS(0:1)
  543.       ISYS(0) = 1
  544.       CALL CCFFT3D(0, 128, 128, 128, 1.0, X, 129, 129, Y, 129, 129,
  545.      &             TABLE, WORK, ISYS)
  546.       CALL CCFFT3D(1, 128, 128, 128, 1.0, X, 129, 129, Y, 129, 129,
  547.      &             TABLE, WORK, ISYS)
  548.  
  549.  
  550.      C/C++:
  551.  
  552.      #include <scsl_fft.h>
  553.      scsl_complex x[129][129][129], y[129][129][129];
  554.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  555.      float work[2*128];
  556.      int isys[2];
  557.      isys[0] = 1;
  558.      ccfft3d(0, 128, 128, 128, 1.0f, (scsl_complex *) x, 129, 129,
  559.             (scsl_complex *) y, 129, 129, table, work, isys);
  560.      ccfft3d(1, 128, 128, 128, 1.0f, (scsl_complex *) x, 129, 129,
  561.             (scsl_complex *) y, 129, 129, table, work, isys);
  562.  
  563.  
  564.      C++ STL:
  565.  
  566.      #include <complex.h>
  567.      #include <scsl_fft.h>
  568.      complex<float> x[129][129][129], y[129][129][129];
  569.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  570.      float work[2*128];
  571.      int isys[2];
  572.      isys[0] = 1;
  573.      ccfft3d(0, 128, 128, 128, 1.0f, (complex<float> *) x, 129, 129,
  574.             (complex<float> *) y, 129, 129, table, work, isys);
  575.      ccfft3d(1, 128, 128, 128, 1.0f, (complex<float> *) x, 129, 129,
  576.             (complex<float> *) y, 129, 129, table, work, isys);
  577.  
  578.  
  579.      Example 3:  With XXXX and YYYY as in example 2, take the inverse FFT of YYYY and
  580.      store it back in XXXX.  The _s_c_a_l_e factor 1.0/(128.0*128.0*128.0) is used.
  581.      Assume that the TTTTAAAABBBBLLLLEEEE array is already initialized.
  582.  
  583.      Fortran:
  584.  
  585.       CALL CCFFT3D(-1, 128, 128, 128, 1.0/(128.0**3), Y, 129, 129,
  586.      &             X, 129, 129, TABLE, WORK, ISYS)
  587.  
  588.  
  589.  
  590.  
  591.                                                                         PPPPaaaaggggeeee 9999
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  599.  
  600.  
  601.  
  602.      C/C++:
  603.  
  604.      ccfft3d(-1, 128, 128, 128, 1.0f/(128.0f*128.0f*128.0f),
  605.             (scsl_complex *) y, 129, 129, (scsl_complex *) x, 129,
  606.             129, table, work, isys);
  607.  
  608.  
  609.      C++ STL:
  610.  
  611.      ccfft3d(-1, 128, 128, 128, 1.0f/(128.0f*128.0f*128.0f),
  612.             (complex<float> *) y, 129, 129, (complex<float> *) x,
  613.             129, 129, table, work, isys);
  614.  
  615.  
  616.      Example 4:  Perform the same computation as in example 2, but put the
  617.      output back in the array _X to save storage space. Use the 8-byte integer
  618.      version of SCSL.
  619.  
  620.      Fortran:
  621.  
  622.       COMPLEX X(0:128, 0:128, 0:128)
  623.       REAL TABLE((2*128 + 256) + (2*128 + 256) + (2*128 + 256))
  624.       REAL WORK (2*128)
  625.       INTEGER ISYS(0:1)
  626.       ISYS(0) = 1_8
  627.       CALL CCFFT3D(0_8, 128_8, 128_8, 128_8, 1.0, X, 129_8, 129_8,
  628.      &             X, 129_8, 129_8, TABLE, WORK, ISYS)
  629.       CALL CCFFT3D(1_8, 128_8, 128_8, 128_8, 1.0, X, 129_8, 129_8,
  630.      &             X, 129_8, 129_8, TABLE, WORK, ISYS)
  631.  
  632.  
  633.      C/C++:
  634.  
  635.      #include <scsl_fft_i8.h>
  636.      scsl_complex x[129][129][129];
  637.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  638.      float work[2*128];
  639.      long long isys[2];
  640.      isys[0] = 1LL;
  641.      ccfft3d(0LL, 128LL, 128LL, 128LL, 1.0f, (scsl_complex *) x, 129LL,
  642.             129LL, (scsl_complex *) x, 129LL, 129LL, table,
  643.             work, isys);
  644.      ccfft3d(1LL, 128LL, 128LL, 128LL, 1.0f, (scsl_complex *) x, 129LL,
  645.             129LL, (scsl_complex *) x, 129LL, 129LL, table,
  646.             work, isys);
  647.  
  648.  
  649.      C++ STL:
  650.  
  651.      #include <complex.h>
  652.      #include <scsl_fft_i8.h>
  653.      complex<float> x[129][129][129];
  654.  
  655.  
  656.  
  657.                                                                        PPPPaaaaggggeeee 11110000
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))                                                        CCCCCCCCFFFFFFFFTTTT3333DDDD((((3333SSSS))))
  665.  
  666.  
  667.  
  668.      float table[(2*128 + 256) + (2*128 + 256) + (2*128 + 256)];
  669.      float work[2*128];
  670.      int isys[2];
  671.      isys[0] = 1;
  672.      ccfft3d(0LL, 128LL, 128LL, 128LL, 1.0f, (complex<float> *) x, 129LL,
  673.              129LL, (complex<float> *) x, 129LL, 129LL, table,
  674.              work, isys);
  675.      ccfft3d(1LL, 128LL, 128LL, 128LL, 1.0f, (complex<float> *) x, 129LL,
  676.              129LL, (complex<float> *) x, 129LL, 129LL, table,
  677.              work, isys);
  678.  
  679.  
  680.      Example 5:  Perform the same computation as in example 2, but assume that
  681.      the lower bound of each Fortran array is 1, rather than 0.  The
  682.      subroutine calls do not change.
  683.  
  684.      Fortran:
  685.  
  686.            COMPLEX X(129, 129, 129)
  687.            COMPLEX Y(129, 129, 129)
  688.            ...
  689.            CALL CCFFT3D(0, 128, 128, 128, 1.0, X, 129, 129,
  690.           &             Y, 129, 129, TABLE, WORK, ISYS)
  691.            CALL CCFFT3D(1, 128, 128, 128, 1.0, X, 129, 129,
  692.           &             Y, 129, 129, TABLE, WORK, ISYS)
  693.  
  694.  
  695. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  696.      IIIINNNNTTTTRRRROOOO____FFFFFFFFTTTT(3S), IIIINNNNTTTTRRRROOOO____SSSSCCCCSSSSLLLL(3S), CCCCCCCCFFFFFFFFTTTT(3S), CCCCCCCCFFFFFFFFTTTT2222DDDD(3S), CCCCCCCCFFFFFFFFTTTTMMMM(3S),
  697.      SSSSCCCCFFFFFFFFTTTT(3S), SSSSCCCCFFFFFFFFTTTT2222DDDD(3S), SSSSCCCCFFFFFFFFTTTT3333DDDD(3S), SSSSCCCCFFFFFFFFTTTTMMMM(3S)
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.                                                                        PPPPaaaaggggeeee 11111111
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.